<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="keywords" content="" /> 
<meta name="description" content="" />
<title>银行卡</title>
<link type="text/css" href="../css/reset.css" rel="stylesheet" />
<link type="text/css" href="../css/public.css" rel="stylesheet" />
<link type="text/css" href="../css/style.css" rel="stylesheet" />
<link type="text/css" href="../css/wode.css" rel="stylesheet" />
<script>
    var deviceWidth = Math.min(640, window.innerWidth)
    document.documentElement.style.fontSize = deviceWidth / 7.5 + "px"
</script>
 <script src="../js/jquery.min.js?v=2.1.4"></script>
<script src="../js/core.js"></script>
<script src="../js/bankCard.js"></script>
<!--<script src="../js/12.7.4shezhiyinghangka.js"></script>-->

</head>

<body>
<!-- top -->
<div class="header">
    <header class="p_header public-red">
        <a href="javascript:history.go(-1);" class="p_header_left">
            <i class="p_left" title="返回"></i>
        </a>
        <h1 class="p_dizhi">银行卡</h1>
    </header>
</div>
<!--银行卡-->
<ul id="OA_task_1">
</ul>
<!--底部-->
<div class="dingdan_bottom">
	<div class="a_foot">
	    <a href=""  id="tianjiayinghang" onclick="tianjia()"><img src="../images/add_baise.png" />添加新银行卡</a>
	</div>
</div>
<!--标准mui.css-->
<link rel="stylesheet" href="../css/mui.min.css">
<!--App自定义的css-->
<link rel="stylesheet" type="text/css" href="../css/app.css" />
<script type="text/javascript" src="../js/mui.min.js"></script>
<!--<script type="text/javascript">
/*	mui.init();
	(function($) {
		//第一个demo，拖拽后显示操作图标，点击操作图标删除元素；
		$('#OA_task_1').on('tap', '.mui-btn', function(event) {
			var elem = this;
			var li = elem.parentNode.parentNode;
			
			var jiedian=this;
			mui.confirm('确认删除该银行？', '确认提示', btnArray, function(e) {
				if (e.index == 0) {
					li.parentNode.removeChild(li);
				} else {
					setTimeout(function() {
						alert("123");
						$.swipeoutClose(li);
					}, 0);
				}
			});
		});
		var btnArray = ['确认', '取消'];
		
		
		
	})(mui);
	
	*/
	
	
	
	
</script>-->

<script>
	
	selectByusers();
function  selectByusers(){
	$("#OA_task_1").html("");
	   $.ajax({
		url: urlcore + "/api/userBank/selectByUser1",
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) {
               $.each(data.data,function(y,n){
               	 var bankInfo = bankCardAttribution(n.bankNumber);
               	var kahao=n.bankNumber.substr(n.bankNumber.length-4);  //加密
               	var OA_task_1=
        '<li class="mui-table-view-cell" onclick="dianji('+n.id+')">'+
		'<div class="a_bank mui-slider-handle">'+
	        '<div class="a_bank_box">'+//<!--图文-->
	            '<dl class="clearfix">'+
	                '<dt><img src="../images/banke.jpg"></dt>'+
	                '<dd>'+
	                    '<h3><input type="hidden"  id="ids'+n.id+'"/>'+n.bankName+'</h3>';
	                 var ssv=0;
	                 $.each(bankInfo, function(q,w) {
	                    	 ssv++;
	                    	 if(ssv==5){
	                    	 	OA_task_1+='<h3>'+w+'</h3>';
	                    	 }
	                    });
	                OA_task_1+='</dd>'+
	            '</dl>'+
	        '</div>'+
	        '<div class="a_shuzi">'+  //<!--数字-->
	             '**** **** ****<span>'+kahao+'</span>'+
	        '</div>'+
	    '</div>'+
	    '<div class="mui-slider-right mui-disabled" onclick="shanchu('+n.id+')">'+
			'<a class="mui-btn mui-btn-red">删除</a>'+
		'</div>'+
	'</li>';             
	   $("#OA_task_1").append(OA_task_1);
               });
			}
		},
		error:function() {
			/* Act on the event */
			alert("error");
		}
	});	
}
  


function shanchu(id){
		//alert(id);
         //var id=$("#ids").val();
		 $.ajax({
		url: urlcore + "/api/userBank/update",
		type: "post",
		contentType: "application/json;charset=utf-8",
		data: JSON.stringify({
			id:id,
			status:2
		}),
		dataType: "json",
		success: function(data) {
			if(data.success == true) {
		     selectByusers();
		     }
		},error: function() {
			alert("error");
		}
	});
		
	}


function dianji(te){
	var shang=document.referrer;
	 var urls=shang.split("?");
	  $.each(urls,function(y,n){
	  	   if(y==0){
	  	   	if("http://127.0.0.1:8020/jgsc_weixin/sell/25.3.0bank_add.html"==n){
	  	   		window.location.href="../sell/25.3.0bank_add.html?id="+te;
	  	   	}
	  	   }
	  });
}

function tianjia(){
	if(uuuuid!=""){
		  $("#tianjiayinghang").attr("href","12.7.9shezhi_bank_add.html?id="+uuuuid);
	}else{
		alert("获取登录用户异常跳转登录页面!");
		 window.location.href ="../gotoindex.html";
	}
	
}

</script>

</body>
</html>